#!/bin/bash

set -e

pnpm build:docker


rm -rf Deploy/.next/* Deploy/public/* Deploy/locales/*

mkdir -p Deploy/.next/standalone Deploy/.next/server Deploy/.next/static Deploy/public

cp package.json Deploy/package.json
cp next.config.ts Deploy/next.config.ts
cp pnpm-workspace.yaml Deploy/pnpm-workspace.yaml
cp pm2.conf.json Deploy/pm2.conf.json
cp .env.example Deploy/.env


# cp -r .next/standalone/* Deploy/.next/standalone
cp -r .next/server/* Deploy/.next/server
cp -r .next/static/* Deploy/.next/static
# cp -r .next/types/* Deploy/.next/types
cp -r .next/app-build-manifest.json Deploy/.next/app-build-manifest.json
cp -r .next/app-path-routes-manifest.json Deploy/.next/app-path-routes-manifest.json
cp -r .next/BUILD_ID Deploy/.next/BUILD_ID
cp -r .next/build-manifest.json Deploy/.next/build-manifest.json
cp -r .next/export-marker.json Deploy/.next/export-marker.json
cp -r .next/images-manifest.json Deploy/.next/images-manifest.json
cp -r .next/next-minimal-server.js.nft.json Deploy/.next/next-minimal-server.js.nft.json
cp -r .next/next-server.js.nft.json Deploy/.next/next-server.js.nft.json
cp -r .next/package.json Deploy/.next/package.json
cp -r .next/prerender-manifest.json Deploy/.next/prerender-manifest.json
cp -r .next/react-loadable-manifest.json Deploy/.next/react-loadable-manifest.json
cp -r .next/required-server-files.json Deploy/.next/required-server-files.json
cp -r .next/routes-manifest.json Deploy/.next/routes-manifest.json

cp -r public/* Deploy/public
cp -r locales/* Deploy/locales

echo "打包完成"
